package com.beiing.tianshuai.tianshuai.message.presenter;

import com.beiing.tianshuai.tianshuai.entity.SearchFriendBean;
import com.beiing.tianshuai.tianshuai.message.model.SearchFriendModel;
import com.beiing.tianshuai.tianshuai.message.model.SearchFriendModelImpl;
import com.beiing.tianshuai.tianshuai.message.view.SearchFriendViewImpl;

/**
 * Created by Jinni on 2017/8/16 0016.
 */

public class SearchFriendPresenter implements SearchFriendPresenterImpl, SearchFriendModel.OnRequestListener {

    private SearchFriendModelImpl mModel;
    private SearchFriendViewImpl mView;

    public SearchFriendPresenter(SearchFriendViewImpl view) {
        mView = view;
        mModel = new SearchFriendModel(this);
    }

    @Override
    public void getSearchFriendResult(String uid, String keyWords) {
        mView.showProgress();
        mModel.getSearchFriendResult(uid, keyWords);
    }

    @Override
    public void onSuccess(SearchFriendBean bean) {
        mView.hideProgress();
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onError(Throwable throwable) {
        mView.hideProgress();
        mView.onRequestFailed(throwable);
    }
}
